//同步“销售负责人”字段的选中人员到团队成员表格中，确保表格中只保留最新的销售负责人记录，避免重复或遗漏。
//table_1688610221855_S3X4W：团队成员；初始化表格（如果不存在）
if(!$this.formModel["table_1688610221855_S3X4W"]) $this.formModel["table_1688610221855_S3X4W"]=[]
//console.log("团队成员表格 = ",$this.formModel['table_1688610221855_S3X4W']);
// for (let i = 0; i < $this.formModel["table_1688610221855_S3X4W"].length; i++) {
//     //body_1688610485722_RuEWp：项目角色； 删除所有“项目角色”为销售负责人的旧记录；是“销售负责人”这个角色对应的字典值ID。
//     if ($this.formModel["table_1688610221855_S3X4W"][i]["body_1688610485722_RuEWp"] == "d1df77238ee6371fffe7276506e4481a"){
//         $this.formModel["table_1688610221855_S3X4W"].splice(i,1)
//         i--
//     }
// }
//systemSelect_1761200168405_7dDJY：销售负责人
let xsfzrs = $this.formModel["systemSelect_1761305069111_62IrS"].split(",")
//systemSelect_1761200168405_7dDJY_ID：销售负责人_ID
let xsfzrIds = $this.formModel["systemSelect_1761305069111_62IrS_ID"].split(",")
for (let i = 0; i < xsfzrs.length; i++) {
    if (xsfzrs[i]){
        $this.formModel["table_1688610221855_S3X4W"].push({
            body_id: $this.$util.uuid(),               // 唯一标识
            create_date: $this.$util.getFormatDate(),  // 创建时间
            index_id: 2,                               // 排序或类型标识
            body_1688610447952_3wkmh: xsfzrs[i],       // 姓名
            body_1688610447952_3wkmh_ID: xsfzrIds[i],  // 姓名ID
            body_1688610485722_RuEWp: "d1df77238ee6371fffe7276506e4481a", // 项目角色
        })
    }
}

if(!$this.formModel["table_1688610221855_S3X4W"]) $this.formModel["table_1688610221855_S3X4W"]=[]
// for (let i = 0; i < $this.formModel["table_1688610221855_S3X4W"].length; i++) {
//     if ($this.formModel["table_1688610221855_S3X4W"][i]["body_1688610485722_RuEWp"] == "d1df77238ee6371fffe7276506e4481a"){
//         $this.formModel["table_1688610221855_S3X4W"].splice(i,1)
//         i--
//     }
// }
let xsfzrs = $this.formModel["systemSelect_1761200168405_7dDJY"].split(",")
let xsfzrIds = $this.formModel["systemSelect_1761200168405_7dDJY_ID"].split(",")
for (let i = 0; i < xsfzrs.length; i++) {
    if (xsfzrs[i]){
        $this.formModel["table_1688610221855_S3X4W"].push({
            body_id: $this.$util.uuid(),
            create_date:  $this.$util.getFormatDate(),
            index_id:2,
            body_1688610447952_3wkmh:xsfzrs[i],
            body_1688610447952_3wkmh_ID:xsfzrIds[i],
            body_1688610485722_RuEWp:"d1df77238ee6371fffe7276506e4481a",
        })
    }
}

$this.formModel["body_1763618737628_edMjL"] = $this.formModel["systemSelect_1763618622972_yBHGU"];
document.getElementById("body_1763618737628_edMjL_ID").value = $this.formModel["systemSelect_1763618622972_yBHGU_ID"];